import Vue from 'vue'
Vue.directive('jujiao', {
  inserted (el) {
    if (['INPUT', 'TEXTAREA'].indexOf(el.tagName) !== -1) {
      el.focus()
    } else {
      let node = el.querySelector('input')
      if (node) {
        node.focus()
        return
      }
      node = el.querySelector('textarea')
      if (node) {
        console.log(node)

        node.focus()
        return
      }
      throw new Error('请把jujiao指令用在input或textarea上')
    }
  }
})
